package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.domain.query.ReplyPageQuery;
import com.tianji.learning.domain.vo.ReplyVO;
import com.tianji.learning.service.IInteractionReplyService;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author xzh
 * @since 2024-03-14
 */
@RestController
@RequestMapping("/interaction-reply")
@AllArgsConstructor(onConstructor_={@Lazy} )
public class InteractionReplyController {

    private final IInteractionReplyService interactionReplyService;

    /**
     * 新增回答或评论
     * @param replyDTO
     */
    @PostMapping("/replies")
    @ApiModelProperty(value = "新增回答或评论")
    public void saveReply(@RequestBody ReplyDTO replyDTO){
        interactionReplyService.saveReply(replyDTO);
    }

    /**
     * 分页查询回答或评论
     * @param query
     * @return
     */
    @GetMapping("/replies/page")
    @ApiOperation(value = "分页查询回答或评论")
    public PageDTO<ReplyVO> replyQueryPage(ReplyPageQuery query){
        return interactionReplyService.replyQueryPage(query);
    }
}
